<!-- 故障报修记录 详情 -->
<template>
	<uni-list :border="false">
		<uni-list-item title="工单号" :note="detailsData.gzdh" :rightText="zfdmFormatter(detailsData.gzdzt)" />
	</uni-list>
	<uni-section title="用户信息" type="line">
		<uni-list :border="false">
			<uni-list-item title="用户编号" :rightText="detailsData.yhbh" />
			<uni-list-item title="用户名称" :rightText="detailsData.yhmc" />
			<uni-list-item title="联系方式" :rightText="detailsData.yhdh" />
			<uni-list-item title="用户地址" :rightText="detailsData.yhdz" />
		</uni-list>
	</uni-section>
	<uni-section title="提交信息" type="line">
		<uni-list :border="false">
			<uni-list-item title="提交时间" :rightText="detailsData.sqsj" />
			<uni-list-item title="提交类型" :rightText="detailsData.sqlx.substring(2)"/>
			<uni-list-item title="提交内容">
				<template v-slot:footer>
					<view style="max-width: 550rpx;color: #999; font-size: 12px; float: right;">
						{{detailsData.bxnr}}
					</view>
				</template>
			</uni-list-item>
		</uni-list>
	</uni-section>
	<uni-section title="处理信息" type="line">
		<uni-list :border="false">
			<uni-list-item title="处理时间" :rightText="detailsData.cljssj" />
			<uni-list-item title="处理方案" :rightText="detailsData.bxclfa" />
			<uni-list-item title="处理结果" :rightText="detailsData.cljg" />
		</uni-list>
	</uni-section>
	<uni-section title="处理信息" type="line">
		<uni-steps :options="SQZTLIST" :active="Number(detailsData.gzdzt)" direction="column" />
	</uni-section>

</template>

<script setup lang="ts">
	import { SysZfdmQuery } from "@/api/request/SysZfdmQuery";
	import { getSysZfdm } from "@/api/syszfdm"
	import { SysZfdm } from "@/api/tables/SysZfdm"
	import { ref } from 'vue';
	import { GzdGzsl } from "@/api/tables/GzdGzsl"
	import { onLoad } from '@dcloudio/uni-app'

	let detailsData =  ref<GzdGzsl>({})
	const SQZTLIST = ref<Array<SysZfdm>>([])
	
	onLoad((option) => {
		getListSQZT()
		let data = option.detailsData || ''
		detailsData.value = JSON.parse(data)
	});


	const getListSQZT = () => {
		SysZfdmQuery({
			data:{zfdm:{dmzl:"SQZT"}},
			success: (result) => {
				let list = result || []
				for (let item of list) {
					item.title = item.dmnr
					item.desc = ''
				}
				SQZTLIST.value = list
			}
		})
		// getSysZfdm({
		// 	dmzl: "SQZT",
		// 	success: (result) => {
		// 		let list = result || []
		// 		for (let item of list) {
		// 			item.title = item.dmnr
		// 			item.desc = ''
		// 		}
		// 		SQZTLIST.value = list
		// 	}
		// })
	}

	function zfdmFormatter(value) {
		let zfdmArr = SQZTLIST.value.filter(item => item.dmbh == value);
		if (zfdmArr.length) {
			return zfdmArr[0].dmnr
		}
		return '';
	}
</script>

<style lang="scss" scoped>
</style>